Trò chơi Angry Birds trong UNITY Engine
31.721 lượt xem;
1 using UnityEngine;
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5
6
7 public class GoTweenCollectionConfig
8 {
9 public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id
10 public int iterations = 1; // number of times to iterate. -1 will loop indefinitely
11 public GoLoopType loopType = Go.defaultLoopType;
12 public GoUpdateType propertyUpdateType = Go.defaultUpdateType;
13
14 public Action<AbstractGoTween> onInitHandler;
15 public Action<AbstractGoTween> onBeginHandler;
16 public Action<AbstractGoTween> onIterationStartHandler;
17 public Action<AbstractGoTween> onUpdateHandler;
18 public Action<AbstractGoTween> onIterationEndHandler;
19 public Action<AbstractGoTween> onCompleteHandler;
20
21
22 /// <summary>
23 /// sets the number of iterations. setting to -1 will loop infinitely
24 /// </summary>
25 public GoTweenCollectionConfig setIterations( int iterations )
26 {
27 this.iterations = iterations;
28 return this;
29 }
30
31
32 /// <summary>
33 /// sets the number of iterations and the loop type. setting to -1 will loop infinitely
34 /// </summary>
35 public GoTweenCollectionConfig setIterations( int iterations, GoLoopType loopType )
36 {
37 this.iterations = iterations;
38 this.loopType = loopType;
39 return this;
40 }
41
42
43 /// <summary>
44 /// sets the update type for the Tween
45 /// </summary>
46 public GoTweenCollectionConfig setUpdateType( GoUpdateType setUpdateType )
47 {
48 this.propertyUpdateType = setUpdateType;
49 return this;
50 }
51
52
53 /// <summary>
54 /// sets the onInit handler for the Tween
55 /// </summary>
56 public GoTweenCollectionConfig onInit( Action<AbstractGoTween> onInit )
57 {
58 onInitHandler = onInit;
59 return this;
60 }
61
62
63 /// <summary>
64 /// sets the onBegin handler for the Tween
65 /// </summary>
66 public GoTweenCollectionConfig onBegin( Action<AbstractGoTween> onBegin )
67 {
68 onBeginHandler = onBegin;
69 return this;
70 }
71
72
73 /// <summary>
74 /// sets the onIterationStart handler for the Tween
75 /// </summary>
76 public GoTweenCollectionConfig onIterationStart( Action<AbstractGoTween> onIterationStart )
77 {
78 onIterationStartHandler = onIterationStart;
79 return this;
80 }
81
82
83 /// <summary>
84 /// sets the onUpdate handler for the Tween
85 /// </summary>
86 public GoTweenCollectionConfig onUpdate( Action<AbstractGoTween> onUpdate )
87 {
88 onUpdateHandler = onUpdate;
89 return this;
90 }
91
92
93 /// <summary>
94 /// sets the onIterationEnd handler for the Tween
95 /// </summary>
96 public GoTweenCollectionConfig onIterationEnd( Action<AbstractGoTween> onIterationEnd )
97 {
98 onIterationEndHandler = onIterationEnd;
99 return this;
100 }
101
102
103 /// <summary>
104 /// sets the onComplete handler for the Tween
105 /// </summary>
106 public GoTweenCollectionConfig onComplete( Action<AbstractGoTween> onComplete )
107 {
108 onCompleteHandler = onComplete;
109 return this;
110 }
111
112
113 /// <summary>
114 /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class
115 /// </summary>
116 public GoTweenCollectionConfig setId( int id )
117 {
118 this.id = id;
119 return this;
120 }
121
122 }
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5
6
7 public class GoTweenCollectionConfig
8 {
9 public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id
10 public int iterations = 1; // number of times to iterate. -1 will loop indefinitely
11 public GoLoopType loopType = Go.defaultLoopType;
12 public GoUpdateType propertyUpdateType = Go.defaultUpdateType;
13
14 public Action<AbstractGoTween> onInitHandler;
15 public Action<AbstractGoTween> onBeginHandler;
16 public Action<AbstractGoTween> onIterationStartHandler;
17 public Action<AbstractGoTween> onUpdateHandler;
18 public Action<AbstractGoTween> onIterationEndHandler;
19 public Action<AbstractGoTween> onCompleteHandler;
20
21
22 /// <summary>
23 /// sets the number of iterations. setting to -1 will loop infinitely
24 /// </summary>
25 public GoTweenCollectionConfig setIterations( int iterations )
26 {
27 this.iterations = iterations;
28 return this;
29 }
30
31
32 /// <summary>
33 /// sets the number of iterations and the loop type. setting to -1 will loop infinitely
34 /// </summary>
35 public GoTweenCollectionConfig setIterations( int iterations, GoLoopType loopType )
36 {
37 this.iterations = iterations;
38 this.loopType = loopType;
39 return this;
40 }
41
42
43 /// <summary>
44 /// sets the update type for the Tween
45 /// </summary>
46 public GoTweenCollectionConfig setUpdateType( GoUpdateType setUpdateType )
47 {
48 this.propertyUpdateType = setUpdateType;
49 return this;
50 }
51
52
53 /// <summary>
54 /// sets the onInit handler for the Tween
55 /// </summary>
56 public GoTweenCollectionConfig onInit( Action<AbstractGoTween> onInit )
57 {
58 onInitHandler = onInit;
59 return this;
60 }
61
62
63 /// <summary>
64 /// sets the onBegin handler for the Tween
65 /// </summary>
66 public GoTweenCollectionConfig onBegin( Action<AbstractGoTween> onBegin )
67 {
68 onBeginHandler = onBegin;
69 return this;
70 }
71
72
73 /// <summary>
74 /// sets the onIterationStart handler for the Tween
75 /// </summary>
76 public GoTweenCollectionConfig onIterationStart( Action<AbstractGoTween> onIterationStart )
77 {
78 onIterationStartHandler = onIterationStart;
79 return this;
80 }
81
82
83 /// <summary>
84 /// sets the onUpdate handler for the Tween
85 /// </summary>
86 public GoTweenCollectionConfig onUpdate( Action<AbstractGoTween> onUpdate )
87 {
88 onUpdateHandler = onUpdate;
89 return this;
90 }
91
92
93 /// <summary>
94 /// sets the onIterationEnd handler for the Tween
95 /// </summary>
96 public GoTweenCollectionConfig onIterationEnd( Action<AbstractGoTween> onIterationEnd )
97 {
98 onIterationEndHandler = onIterationEnd;
99 return this;
100 }
101
102
103 /// <summary>
104 /// sets the onComplete handler for the Tween
105 /// </summary>
106 public GoTweenCollectionConfig onComplete( Action<AbstractGoTween> onComplete )
107 {
108 onCompleteHandler = onComplete;
109 return this;
110 }
111
112
113 /// <summary>
114 /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class
115 /// </summary>
116 public GoTweenCollectionConfig setId( int id )
117 {
118 this.id = id;
119 return this;
120 }
121
122 }